<template>
<div class="school">
  <h2>学校名称: {{name}}</h2>
  <h2>学校地址: {{address}}</h2>
</div>
</template>

<script>
export default {
  name: "QuanJuShiJianZongXianSchool",
  data() {
    return {
      name: '清华大学',
      address: '北京',
    }
  },
  methods: {
    demo(data) {
      console.log('我是School组件，收到了数据: ', data)
    }
  },
  mounted() {
    this.$bus.$on('demo', this.demo)
  },
  beforeDestroy() {
    this.$bus.$off('demo', this.demo)
  }
}
</script>

<style scoped>
.school{
  background-color: skyblue;
  padding: 5px;
}
</style>
